local skynet = require "skynet"
local config = require "configquery"
local cluster = require "cluster"
require "skynet.manager"
require "common"

local Objects = require "Objects"
local Command = require "Command"
local Message = require "Message"

local svr_id = skynet.getenv("svr_id")

g_handler = {
	svr_id = svr_id,
	svr_config = {},
	msg = {},
	command = {},
}
g_objects = Objects.new()


local function init()
	--load_table_service()
	local message = Message.new('manager_service')
	g_objects:add(message)
	local command = Command.new(message)
	g_objects:add(command)
	g_objects:hotfix()
	
	local svr_config = config.setting_cfg["gamesvrs"][svr_id]
	g_handler.svr_config = svr_config
	skynet.newservice("debug_console",svr_config.debug_port)
	skynet.dispatch("lua", message:dispatch())
end
---------------------------------------------------------
-- skynet
---------------------------------------------------------

skynet.start(function()
	init()

	skynet.register('.proxy')--每个进程 收进程间的消息的一个服务名
	cluster.open(svr_id)



end)
